/**
 * $Revision: 1.0 $
 * $Author: Eric Yang $
 * $Date: Aug 30, 2009 9:42:20 PM $
 *
 * Author: Eric Yang
 * Date  : Aug 30, 2009 9:42:20 PM
 *
 */
package com.gooex.web.action.gbuy.usercenter.company;

import com.gooex.domain.company.Company;
import com.gooex.service.company.ICompanyManager;
import com.gooex.web.action.BaseProtectedAction;


/**
 * @author Eric Yang
 * @version 1.0
 */
public class RemoveCompany extends BaseProtectedAction {

	private ICompanyManager companyManager;

	private String id;

	public String execute() throws Exception {
		Company company = companyManager.getCompany(id);
		if (company != null && getCurrentUser().equals(company.getUser()))
			companyManager.removeCompany(company);
		return SUCCESS;
	}

	public void setId(String id) {
		this.id = id;
	}

	public void setCompanyManager(ICompanyManager companyManager) {
		this.companyManager = companyManager;
	}

}
